<?php
$charset = isset($_REQUEST['charset']) ? $_REQUEST['charset'] : "UTF-8";
$title = isset($_REQUEST['title']) ? $_REQUEST['title'] : "*.*";
$content = isset($_REQUEST['content']) ? $_REQUEST['content'] : "";
$output = file_get_contents("saveTemplate.html");
$output = str_replace('${charset}', $charset, $output);
$output = str_replace('${content}', $content, $output);
$length = strlen($output);
header("Content-Type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Content-Length: ".$length);
header("Content-Disposition: attachment; filename=".$title.".html");
echo $output;
?>